package com.bootssm.service.impl;

import com.bootssm.dao.TeamBallMapper;
import com.bootssm.enity.TeamBall;
import com.bootssm.enity.TeamBallQueryV0;
import com.bootssm.enity.TeamBallResultV0;
import com.bootssm.enity.TeamballResultQueryVO;
import com.bootssm.service.TeamBallService;
import com.bootssm.utils.IdWorker;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TeamBallServiceImpl implements TeamBallService {

    @Autowired
    TeamBallMapper teamBallMapper;

    @Autowired
    IdWorker idWorker;

    @Override
    public List<TeamBall> findAll(TeamBallQueryV0 teamBallQueryV0) {
        return teamBallMapper.findAll(teamBallQueryV0);
    }

    @Override
    public Integer getScheduleCount(TeamballResultQueryVO teamballResultQueryVO) {
        return teamBallMapper.getScheduleCount(teamballResultQueryVO);
    }

    @Override
    public List<TeamBallResultV0> findResultAll(TeamballResultQueryVO teamballResultQueryVO) {
        return teamBallMapper.findResultAll(teamballResultQueryVO);
    }

    @Override
    public TeamBall findById(String teamballid) {
        return teamBallMapper.findById(teamballid);
    }

    @Override
    public void deleteById(String teamBallId) {
        teamBallMapper.deleteById(teamBallId);
    }

    @Override
    public void save(TeamBall teamBall) {
        teamBall.setTeamballid(idWorker.nextId()+"");
        teamBallMapper.save(teamBall);
    }

    @Override
    public void update(TeamBall teamBall) {
        teamBallMapper.update(teamBall);
    }
}
